$(function(){
	var time=new Date();
	var day=time.getDate();
	var year=time.getFullYear(); 
  	var month=time.getMonth()+1;
  	console.log(`2017年6月至1日${year}年${month}月${day}`)
  	$('.time').html(`(2017年6月1日至${year}年${month}月${day}日)`)
	console.log(time)
	{if $Think.get.number}
	{else/}
	var car_number = echarts.init(document.getElementById('car_number'));
	option = {
		tooltip: {
			trigger: 'item',
			formatter: "{a} <br/>{b}: {c} ({d}%)"
		},
		legend: {
			orient: 'vertical',
			x: 'left',
			data: ['关联车辆', '未关联车辆']
		},
		series: [{
			name: '订单数量',
			type: 'pie',
			radius: ['50%', '70%'],
			avoidLabelOverlap: false,
			label: {
				normal: {
					show: false,
					position: 'center'
				},
				emphasis: {
					show: true,
					textStyle: {
						fontSize: '15',
						fontWeight: 'bold'
					}
				}
			},
			labelLine: {
				normal: {
					show: false
				}
			},
			data: [{
					value: {$item.bind},
					name: '关联车辆'
				},
				{
					value: {$item.all-$item.bind},
					name: '未关联车辆'
				}
			]
		}]
	};
	car_number.setOption(option);
	
	{/if}
//	var fuelconsumption = echarts.init(document.getElementById('fuelconsumption'));
//      optionfuel = {
//          tooltip: {
//              trigger: 'axis'
//          },
//          grid: {
//              top: '3%',
//              left: '3%',
//              right: '4%',
//              bottom: '3%',
//              containLabel: true
//          },
//          xAxis: [{
//              type: 'category',
//              boundaryGap: false,
//              data: []
//          }],
//          yAxis: [{
//              type: 'value'
//          }],
//          textStyle: {
//              color: '#838FA1'
//          },
//          series: [{
//              name: '',
//              type: 'line',
//              stack: '总量',
//              areaStyle: { normal: {} },
//              data: [],
//              itemStyle: { 
//                  normal: {
//                      color: '#1cabdb',
//                      borderColor: '#1cabdb',
//                      borderWidth: '2',
//                      borderType: 'solid',
//                      opacity: '1'
//                  },
//                  emphasis: {
//
//                  }
//              }
//          }]
//      };
//
//      fuelconsumption.setOption(optionfuel);
        $('.service').on('click', function() {
        	if($(this).closest('.outline').data('number')){
        		choosecar("{:url('service/index',['op'=>'search'])}?number="+$(this).closest('.outline').data('number'))
        	}else if($(this).closest('.outline').data('company')){
        		
        		choosecar("{:url('service/index',['op'=>'search'])}?company="+$(this).closest('.outline').data('company'))
        	}else{
        		choosecar("{:url('service/index',['op'=>'search'])}")
        	}
			
		});
		$('.survey').on('click', function() {
			if($(this).closest('.outline').data('number')){
        		choosecar("{:url('survey/index',['op'=>'search'])}?number="+$(this).closest('.outline').data('number'))
        	}else if($(this).closest('.outline').data('company')){
        		choosecar("{:url('survey/index',['op'=>'search'])}?company="+$(this).closest('.outline').data('company'))
        	}else{
        		choosecar("{:url('survey/index',['op'=>'search'])}")
        	}
		});
		$('.refuel').on('click', function() {
			if($(this).closest('.outline').data('number')){
        		choosecar("{:url('refuel/index',['op'=>'search'])}?number="+$(this).closest('.outline').data('number'))
        	}else if($(this).closest('.outline').data('company')){
        		choosecar("{:url('refuel/index',['op'=>'search'])}?company="+$(this).closest('.outline').data('company'))
        	}else{
        		choosecar("{:url('refuel/index',['op'=>'search'])}")
        	}
		});
		$('.insure').on('click', function() {
			if($(this).closest('.outline').data('number')){
        		choosecar("{:url('insure/index',['op'=>'search'])}?number="+$(this).closest('.outline').data('number'))
        	}else if($(this).closest('.outline').data('company')){
        		choosecar("{:url('insure/index',['op'=>'search'])}?company="+$(this).closest('.outline').data('company'))
        	}else{
        		choosecar("{:url('insure/index',['op'=>'search'])}")
        	}
		});
		$('.timeclassify>button').on('click', function() {
		$('.time').val($(this).data('val'))	
		})
		$('.car_number').on('click', function() {
			choosecar("{:url('car/index',['op'=>'search'])}")
		});
		$('.company').on('click', function() {
			choosecar("{:url('rent/index',['op'=>'search'])}")
		});
		$('.driverstat').on('change',function(){
			console.log(1)
			if($(this).val()==1){
				$('.number').attr('type','text')
				$('.number').attr('name','number')
				$('.company').attr('type','hidden')
				$('.company').removeAttr('name')
			}else{
				$('.company').attr('type','text')
				$('.company').attr('name','company')
				$('.number').attr('type','hidden')
				$('.number').removeAttr('name')
			}
		})
})
